Repository navigation
fix(base): 上方的行量到新高度时,屏幕上的行保持不动 - #86
Closed
xiaoyumuxi wants to merge 1 commit into
Closed
xiaoyumuxi wants to merge 1 commit into
xiaoyumuxi wants to merge 1 commit into
Conversation
A List places rows it has not measured by the average height of those it has. Measuring a row above the viewport, or the estimate changing with it, moved where every row on screen was computed to start, so reading a long list of uneven rows upward from its end (or after a fling skipped rows) made the rows jump, sometimes by more than the viewport. The list now keeps the row at the top of the viewport where the offset was chosen for it: the next paint moves the offset by as much as that row moved in content space, and a paint whose overscan rows measured differently is painted again with the offset kept. Requests to scroll, following the end and scrollbar drags are left as they were.
This was referenced Dec 1, 2026
|
已被上游 vivaui#532 (dd048cd) 取代,并在 #89 同步进 fork main。 |
16 of 19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
List 对没量过的行按已量行的平均高度估算位置。往上量到新行,或者平均值随之变化时,视口里每一行的计算起点都会跟着移动,但滚动偏移没有补偿,所以屏幕上的内容会跳。
复现(600 行,30/30/300 交替,480 高视口,从末尾每次滚轮 24):修复前,追踪的一行多次在一次滚轮后直接离开屏幕,最大偏差 88 px 以上;修复后每一步都移动 24 ± 1 px。
修复(
base/list.go)keepAnchor)。两次排版之间滚轮和按键带来的位移保持不变。p.retry),这一帧带着补偿后的偏移重画一次,不把错位显示出来。Tree 用同一个
ListArea,一起受益。测试
ui/list_anchor_test.go:TestListKeepsTheRowsOnScreenAsRowsAboveAreMeasured。撤掉修复后失败,加上后通过。go test ./base/ ./ui/全部通过。components、internal/gallery、tools/docs、tools/visualparity的失败在 fork main 上原本就有(dock 文档目录、OTP 示例、对照像素),和本改动无关。